package com.remrbs.controller;

import com.remrbs.Vo.ResultVo;
import com.remrbs.domain.User;
import com.remrbs.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/Register")
public class RegisterController {

    @Autowired
    private UserService userService;

    /**
     * 注册
     * @param user
     * @return
     */
    @PostMapping("/enroll")
    public int register(@RequestBody User user){
        return userService.insertSelective(user);
    }

    /**
     * 用户名检验
     * @param username
     * @return
     */
    @GetMapping("check")
    public ResultVo checkUsername(@RequestParam("username") String username){
        return userService.checkUsername(username);
    }

}
